//
//  YQJSBridgeWebViewController.m
//  CusWebView
//
//  Created by yeqiang on 2024/2/20.
//

#import "YQJSBridgeWebViewController.h"
#import "YQJSBridge+WebViewController.h"

@interface YQJSBridgeWebViewController ()

@end

@implementation YQJSBridgeWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.bridge.webViewController = self;
    [self.bridge setWebViewDelegate:self];
}

- (instancetype)initWithURL:(NSURL *)url {
    self = [super init];
    if (self) {
        self.url = url;
    }
    return self;
}


- (void)resetWebView {
    [super resetWebView];
    self.bridge = nil;
//    self.bridge.webViewController = self;
    [self.bridge setWebViewDelegate:self];
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
     [super webView:webView didFinishNavigation:navigation];
}

- (YQJSBridge *)bridge {
    if (!_bridge) {
        _bridge = [YQJSBridge bridgeForWebView:self.webView];
    }
    return _bridge;
}

@end
